home *** CD-ROM | disk | FTP | other *** search
/ Aspects of Cyprus 2 / Aspects of Cyprus.iso / pc / aoc.swf / scripts / DefineSprite_42_menu / frame_2 / DoAction.as
Encoding:
Text File  |  2005-12-03  |  7.7 KB  |  189 lines

  1. function XMLLoadingError()
  2. {
  3.    fscommand("quit");
  4. }
  5. function CreateMenu(menuXML, menuName, xPos, yPos)
  6. {
  7.    this.createEmptyMovieClip("menu_ver",1);
  8.    this.menu_ver._x = xPos;
  9.    this.menu_ver._y = yPos;
  10.    this.menu_ver_xPos = this.menu_ver._x;
  11.    this.menu_ver_yPos = this.menu_ver._y;
  12.    this.menu_ver_depth = 1;
  13.    this.createEmptyMovieClip("menu_hor",2);
  14.    this.menu_hor._x = 507;
  15.    this.menu_hor._y = 65;
  16.    this.menu_hor_xPos = this.menu_hor._x;
  17.    this.menu_hor_yPos = this.menu_hor._y;
  18.    this.menu_hor_depth = 1000;
  19.    if(menuXML.firstChild.nodeName == "menu_1")
  20.    {
  21.       CreateMenu_1(menuXML,"menu_1",this.menu_ver_xPos,this.menu_ver_yPos);
  22.    }
  23.    else
  24.    {
  25.       XMLLoadingError();
  26.    }
  27. }
  28. function CreateMenu_1(menuXML, menuName)
  29. {
  30.    var _loc9_ = menuXML.childNodes.length;
  31.    var _loc2_ = 0;
  32.    while(_loc2_ < _loc9_)
  33.    {
  34.       if(menuXML.childNodes[_loc2_].nodeName == menuName)
  35.       {
  36.          var _loc3_ = menuName + "_" + _loc2_;
  37.          var _loc6_ = menuXML.childNodes[_loc2_].attributes.id;
  38.          var _loc5_ = menuXML.childNodes[_loc2_].attributes.name;
  39.          var _loc8_ = menuXML.childNodes[_loc2_].attributes.photo_gallery;
  40.          this.menu_ver_depth += 1;
  41.          this.menu_ver.attachMovie("item_" + menuName,_loc3_,this.menu_ver_depth);
  42.          this.menu_ver[_loc3_]._x = this.menu_ver_xPos;
  43.          this.menu_ver_yPos += this.menu_ver[_loc3_]._height;
  44.          this.menu_ver[_loc3_]._y = this.menu_ver_yPos;
  45.          this.menu_ver[_loc3_].menu_name.text = _loc5_;
  46.          this.menu_ver[_loc3_].m_1 = _loc2_;
  47.          this.menu_ver[_loc3_].m_2 = -1;
  48.          this.menu_ver[_loc3_].m_3 = -1;
  49.          this.menu_ver[_loc3_].m_4 = -1;
  50.          this.menu_ver[_loc3_].id = _loc6_;
  51.          this.menu_ver[_loc3_].name = _loc5_;
  52.          this.menu_ver[_loc3_].photo_gallery_exists = _loc8_;
  53.          if(_loc2_ != this.menu_1_clicked)
  54.          {
  55.             this.menu_ver[_loc3_].btn.onRelease = function()
  56.             {
  57.                this._parent._parent._parent.initButtonsClicked(1,this._parent.m_1);
  58.                this._parent._parent._parent.gotoAndPlay(2);
  59.                this._parent._parent._parent._parent.initCurrentSection(this._parent.m_1,this._parent.m_2,this._parent.m_3,this._parent.m_4,this._parent.id,this._parent.name,this._parent.photo_gallery_exists);
  60.             };
  61.          }
  62.       }
  63.       if(menuXML.childNodes[_loc2_].firstChild.nodeName == "menu_2")
  64.       {
  65.          if(_loc2_ == this.menu_1_clicked)
  66.          {
  67.             CreateMenu_2(menuXML.childNodes[_loc2_],"menu_2",_loc2_);
  68.          }
  69.       }
  70.       _loc2_ = _loc2_ + 1;
  71.    }
  72. }
  73. function CreateMenu_2(menuXML, menuName, parent_1)
  74. {
  75.    var _loc9_ = menuXML.childNodes.length;
  76.    var _loc3_ = 0;
  77.    while(_loc3_ < _loc9_)
  78.    {
  79.       if(menuXML.childNodes[_loc3_].nodeName == menuName)
  80.       {
  81.          var _loc2_ = menuName + "_" + parent_1 + "_" + _loc3_;
  82.          var _loc6_ = menuXML.childNodes[_loc3_].attributes.id;
  83.          var _loc5_ = menuXML.childNodes[_loc3_].attributes.name;
  84.          this.menu_ver_depth += 1;
  85.          this.menu_ver.attachMovie("item_" + menuName,_loc2_,this.menu_ver_depth);
  86.          this.menu_ver[_loc2_]._x = this.menu_ver_xPos;
  87.          this.menu_ver_yPos += this.menu_ver[_loc2_]._height;
  88.          this.menu_ver[_loc2_]._y = this.menu_ver_yPos;
  89.          this.menu_ver[_loc2_].menu_name.text = _loc5_;
  90.          this.menu_ver[_loc2_].m_1 = parent_1;
  91.          this.menu_ver[_loc2_].m_2 = _loc3_;
  92.          this.menu_ver[_loc2_].m_3 = -1;
  93.          this.menu_ver[_loc2_].m_4 = -1;
  94.          this.menu_ver[_loc2_].id = _loc6_;
  95.          this.menu_ver[_loc2_].name = _loc5_;
  96.          this.menu_ver[_loc2_].btn.onRelease = function()
  97.          {
  98.             this._parent._parent._parent.initButtonsClicked(2,this._parent.m_2);
  99.             this._parent._parent._parent.gotoAndPlay(2);
  100.             this._parent._parent._parent._parent.initCurrentSection(this._parent.m_1,this._parent.m_2,this._parent.m_3,this._parent.m_4,this._parent.id,this._parent.name,"");
  101.          };
  102.       }
  103.       if(menuXML.childNodes[_loc3_].firstChild.nodeName == "menu_3")
  104.       {
  105.          if(_loc3_ == this.menu_2_clicked)
  106.          {
  107.             CreateMenu_3(menuXML.childNodes[_loc3_],"menu_3",parent_1,_loc3_);
  108.          }
  109.       }
  110.       _loc3_ = _loc3_ + 1;
  111.    }
  112. }
  113. function CreateMenu_3(menuXML, menuName, parent_1, parent_2)
  114. {
  115.    var _loc12_ = menuXML.childNodes.length;
  116.    var _loc3_ = 0;
  117.    while(_loc3_ < _loc12_)
  118.    {
  119.       if(menuXML.childNodes[_loc3_].nodeName == menuName)
  120.       {
  121.          var _loc2_ = menuName + "_" + parent_1 + "_" + parent_2 + "_" + _loc3_;
  122.          var _loc9_ = menuXML.childNodes[_loc3_].attributes.id;
  123.          var _loc5_ = menuXML.childNodes[_loc3_].attributes.name;
  124.          this.menu_hor_depth += 1;
  125.          this.menu_hor.attachMovie("item_" + menuName,_loc2_,this.menu_hor_depth);
  126.          this.menu_hor[_loc2_]._y = this.menu_hor_yPos;
  127.          this.menu_hor_xPos -= this.menu_hor[_loc2_]._width;
  128.          this.menu_hor[_loc2_]._x = this.menu_hor_xPos;
  129.          this.menu_hor[_loc2_].menu_name.text = _loc5_;
  130.          this.menu_hor[_loc2_].m_1 = parent_1;
  131.          this.menu_hor[_loc2_].m_2 = parent_2;
  132.          this.menu_hor[_loc2_].m_3 = _loc3_;
  133.          this.menu_hor[_loc2_].m_4 = -1;
  134.          this.menu_hor[_loc2_].id = _loc9_;
  135.          this.menu_hor[_loc2_].name = _loc5_;
  136.          this.menu_hor[_loc2_].btn.onRelease = function()
  137.          {
  138.             this._parent._parent._parent.initButtonsClicked(3,this._parent.m_3);
  139.             this._parent._parent._parent.gotoAndPlay(2);
  140.             this._parent._parent._parent._parent.initCurrentSection(this._parent.m_1,this._parent.m_2,this._parent.m_3,this._parent.m_4,this._parent.id,this._parent.name,"");
  141.          };
  142.       }
  143.       if(menuXML.childNodes[_loc3_].firstChild.nodeName == "menu_4")
  144.       {
  145.          if(_loc3_ == this.menu_3_clicked)
  146.          {
  147.             var _loc7_ = this.menu_hor[_loc2_]._x;
  148.             var _loc6_ = this.menu_hor[_loc2_]._y;
  149.             CreateMenu_4(menuXML.childNodes[_loc3_],"menu_4",parent_1,parent_2,_loc3_,_loc7_,_loc6_);
  150.          }
  151.       }
  152.       _loc3_ = _loc3_ + 1;
  153.    }
  154. }
  155. function CreateMenu_4(menuXML, menuName, parent_1, parent_2, parent_3, xPos, yPos)
  156. {
  157.    var _loc12_ = menuXML.childNodes.length;
  158.    var _loc3_ = 0;
  159.    while(_loc3_ < _loc12_)
  160.    {
  161.       if(menuXML.childNodes[_loc3_].nodeName == menuName)
  162.       {
  163.          var _loc2_ = menuName + "_" + parent_1 + "_" + parent_2 + "_" + parent_3 + "_" + _loc3_;
  164.          var _loc7_ = menuXML.childNodes[_loc3_].attributes.id;
  165.          var _loc4_ = menuXML.childNodes[_loc3_].attributes.name;
  166.          this.menu_hor_depth += 1;
  167.          this.menu_hor.attachMovie("item_" + menuName,_loc2_,this.menu_hor_depth);
  168.          this.menu_hor[_loc2_]._x = xPos;
  169.          yPos += this.menu_hor[_loc2_]._height;
  170.          this.menu_hor[_loc2_]._y = yPos;
  171.          this.menu_hor[_loc2_].menu_name.text = _loc4_;
  172.          this.menu_hor[_loc2_].m_1 = parent_1;
  173.          this.menu_hor[_loc2_].m_2 = parent_2;
  174.          this.menu_hor[_loc2_].m_3 = parent_3;
  175.          this.menu_hor[_loc2_].m_4 = _loc3_;
  176.          this.menu_hor[_loc2_].id = _loc7_;
  177.          this.menu_hor[_loc2_].name = _loc4_;
  178.          this.menu_hor[_loc2_].btn.onRelease = function()
  179.          {
  180.             this._parent._parent._parent.initButtonsClicked(3);
  181.             this._parent._parent._parent.initButtonsClicked(4,this._parent.m_4);
  182.             this._parent._parent._parent.gotoAndPlay(2);
  183.             this._parent._parent._parent._parent.initCurrentSection(this._parent.m_1,this._parent.m_2,this._parent.m_3,this._parent.m_4,this._parent.id,this._parent.name,"");
  184.          };
  185.       }
  186.       _loc3_ = _loc3_ + 1;
  187.    }
  188. }
  189.